package com.rd.student.ruanjian.class4.zhouzihe.exam;

import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Scanner;

public class Test2 {
    public static void main(String[] args) throws IOException {
        String projectPath = System.getProperty("user.dir");
        File file = new File(projectPath + "//" + "player.txt");
        file.createNewFile();
        for (int i = 0; i < 5; i++) {
            Scanner scanner = new Scanner(System.in);
            System.out.println("请输入球员名字");
            String name = scanner.next();

        }
        ArrayList<Player> arrayList = new ArrayList<>();
        Player player1 = new Player("杜兰特", "勇士队");
        Player player2 = new Player("威少", "雷霆队");
        Player player3 = new Player("库里", "勇士队");
        Player player4 = new Player("石破天", "湖人队");
        Player player5 = new Player("科比", "湖人队");
        arrayList.add(player1);
        arrayList.add(player2);
        arrayList.add(player3);
        arrayList.add(player4);
        arrayList.add(player5);

        BufferedWriter bw = new BufferedWriter(new FileWriter(file));
        bw.write("杜兰特" + "\t");
        bw.write("威少" + "\t");
        bw.write("库里" + "\t" + "\t");
        bw.write("石破天" + "\t");
        bw.write("科比" + "\t");
        bw.newLine();
        bw.flush();
        for (Player p : arrayList) {
            String team = p.getTeam();
            bw.write(team + "\t");
        }
        bw.close();

    }
}

class Player {
    String name;
    String team;

    public Player(String name, String team) {
        this.name = name;
        this.team = team;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getTeam() {
        return team;
    }

    public void setTeam(String team) {
        this.team = team;
    }
}
